package fun.flyee.android.pengshan.acts;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.OnClick;
import fun.flyee.pengshan.social.R;

public abstract class BaseBarActivity extends BaseActivity {

    @BindView(R.id.title_view)
    public TextView titleView;
    @BindView(R.id.right_btn)
    public TextView rightBtn;

    @Override
    protected void onCreate(Bundle saveIntentBundle) {
        super.onCreate(saveIntentBundle);
        titleView.setText(getActionTitle());
        if (TextUtils.isEmpty(getRigthBtn())) {
            rightBtn.setVisibility(View.GONE);
        } else {
            rightBtn.setVisibility(View.VISIBLE);
            rightBtn.setText(getRigthBtn());
        }
    }


    @OnClick(R.id.back_btn)
    public void onBackClick(View v) {
        finish();
    }

    @OnClick(R.id.right_btn)
    public void onRightClick(View v) {
        onRightBtnClick();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
    }

    protected abstract String getActionTitle();

    protected abstract String getRigthBtn();

    protected abstract void onRightBtnClick();

}
